home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d883.lha / BBBBS / BBBBS59.lha / rexx / bbsExtDL.baud < prev    next >
Text File  |  1993-06-02  |  15KB  |  512 lines

  1. /*      $VERS: 5.9 bbsExtDL.baud 2 June 1993 (2.6.93)
  2.     copyright 1992 Richard Lee Stockton FREELY DISTRIBUTABLE
  3.  
  4. Allows BBBBS user to download from extra devices like CD drives.
  5.  Keeps track of time left to this user, and watches for hangup.
  6.  
  7.   Just ignores file or directory names that contain spaces
  8.    because BBBBS would be unable to download them anyway.
  9.   Ignores icons (files that end in .info). Also excludes certain
  10.    drawers on certain CDs that contain copyright files. Other
  11.    specific files or directories can be excluded by adding
  12.    their paths to the exclude variable below.
  13. */
  14.  
  15. exclude=''
  16.  
  17. /* HyperMedia FredFish CD FFCD_800 - limited to 2 drawers */
  18. exclude=exclude 'FFCD_800:C FFCD_800:DEVS'
  19. exclude=exclude 'FFCD_800:L FFCD_800:LIBS'
  20. exclude=exclude 'FFCD_800:S FFCD_800:FONTS'
  21. exclude=exclude 'FFCD_800:T FFCD_800:PREFS'
  22. exclude=exclude 'FFCD_800:SYSTEM    FFCD_800:SID'
  23. exclude=exclude 'FFCD_800:Locators  FFCD_800:UTILITIES'
  24. exclude=exclude 'FFCD_800:CATALOGS  FFCD_800:CDS.FILES'
  25. exclude=exclude 'FFCD_800:EXPANSION'
  26. exclude=exclude 'FFCD_800:Read_Me   FFCD_800:TRASHCAN'
  27. exclude=exclude 'FFCD_800:SHELL     FFCD_800:TOOLS'
  28. exclude=exclude 'FFCD_800:cdtv.tm   FFCD_800:Node.rinfo'
  29. exclude=exclude 'FFCD_800:PARNET    FFCD_800:START_PARNET'
  30. exclude=exclude 'FFCD_800:Copy_Fish FFCD_800:CD_Sampler'
  31. exclude=exclude 'FFCD_800:start.pic FFCD_800:ParNet_Switch'
  32.  
  33. /* HyperMedia FredFish Online CD version 1.5 - limited to 2 drawers */
  34. exclude=exclude 'FFONL_V1.5:LZH_FILES/CATALOGS'
  35. exclude=exclude 'FFONL_V1.5:C FFONL_V1.5:DEVS'
  36. exclude=exclude 'FFONL_V1.5:L FFONL_V1.5:LIBS'
  37. exclude=exclude 'FFONL_V1.5:S FFONL_V1.5:FONTS'
  38. exclude=exclude 'FFONL_V1.5:T FFONL_V1.5:PREFS'
  39. exclude=exclude 'FFONL_V1.5:SYSTEM    FFONL_V1.5:SID'
  40. exclude=exclude 'FFONL_V1.5:AQUARIUM  FFONL_V1.5:UTILITIES'
  41. exclude=exclude 'FFONL_V1.5:CATALOGS  FFONL_V1.5:CDS.FILES'
  42. exclude=exclude 'FFONL_V1.5:EXPANSION FFONL_V1.5:READMEMASTER'
  43. exclude=exclude 'FFONL_V1.5:READ_ME   FFONL_V1.5:TRASHCAN'
  44. exclude=exclude 'FFONL_V1.5:SHELL     FFONL_V1.5:TOOLS'
  45. exclude=exclude 'FFONL_V1.5:CDTV.TM   FFONL_V1.5:NODE.RINFO'
  46. exclude=exclude 'FFONL_V1.5:PARNET    FFONL_V1.5:START_PARNET'
  47. exclude=exclude 'FFONL_V1.5:COPYRITE.TXT'
  48.  
  49. /* HyperMedia FredFish Online CD version 1.4 - limited to 2 drawers */
  50. exclude=exclude 'FFONL_V1.4:LZH_FILES/CATALOGS'
  51. exclude=exclude 'FFONL_V1.4:C FFONL_V1.4:DEVS'
  52. exclude=exclude 'FFONL_V1.4:L FFONL_V1.4:LIBS'
  53. exclude=exclude 'FFONL_V1.4:S FFONL_V1.4:FONTS'
  54. exclude=exclude 'FFONL_V1.4:T FFONL_V1.4:PREFS'
  55. exclude=exclude 'FFONL_V1.4:SYSTEM    FFONL_V1.4:SID'
  56. exclude=exclude 'FFONL_V1.4:AQUARIUM  FFONL_V1.4:UTILITIES'
  57. exclude=exclude 'FFONL_V1.4:CATALOGS  FFONL_V1.4:CDS.FILES'
  58. exclude=exclude 'FFONL_V1.4:EXPANSION FFONL_V1.4:READMEMASTER'
  59. exclude=exclude 'FFONL_V1.4:READ_ME   FFONL_V1.4:TRASHCAN'
  60. exclude=exclude 'FFONL_V1.4:SHELL     FFONL_V1.4:TOOLS'
  61. exclude=exclude 'FFONL_V1.4:CDTV.TM   FFONL_V1.4:NODE.RINFO'
  62. exclude=exclude 'FFONL_V1.4:PARNET    FFONL_V1.4:START_PARNET'
  63. exclude=exclude 'FFONL_V1.4:COPYRITE.TXT'
  64.  
  65. /* HyperMedia FredFish CD version 1.2 - limited to 3 drawers */
  66. exclude=exclude 'FFCD_V1.2:LZH_FILES/CATALOGS'
  67. exclude=exclude 'FFCD_V1.2:C FFCD_V1.2:DEVS'
  68. exclude=exclude 'FFCD_V1.2:L FFCD_V1.2:LIBS'
  69. exclude=exclude 'FFCD_V1.2:S FFCD_V1.2:FONTS'
  70. exclude=exclude 'FFCD_V1.2:T FFCD_V1.2:PREFS'
  71. exclude=exclude 'FFCD_V1.2:SYSTEM    FFCD_V1.2:SID'
  72. exclude=exclude 'FFCD_V1.2:AQUARIUM  FFCD_V1.2:UTILITIES'
  73. exclude=exclude 'FFCD_V1.2:CATALOGS  FFCD_V1.2:CDS.FILES'
  74. exclude=exclude 'FFCD_V1.2:EXPANSION FFCD_V1.2:READMEMASTER'
  75. exclude=exclude 'FFCD_V1.2:READ_ME   FFCD_V1.2:TRASHCAN'
  76. exclude=exclude 'FFCD_V1.2:SHELL'
  77. exclude=exclude 'FFCD_V1.2:CDTV.TM FFCD_V1.2:CD_SAMPLER'
  78.  
  79. /* Xetec Fish and More Vols I and II */
  80. exclude=exclude 'FISH_AND_MORE:C FISH_AND_MORE:SYSTEM FISH_AND_MOREII:C'
  81. exclude=UPPER(exclude)
  82.  
  83. SIGNAL ON BREAK_C
  84. SIGNAL ON BREAK_E
  85.  
  86. PARSE ARG name level maxtime linesperpage colorflag devlist 
  87.  
  88. lists.=''
  89. lists.0=0
  90. maxtime=maxtime-30
  91. CALL TIME('R')
  92. CR='0D'x
  93. def=''
  94. pen3=''
  95. IF colorflag~=1 THEN
  96.   DO
  97.     def=''
  98.     pen3=''
  99.   END
  100.  
  101. SAY CR
  102. SAY 'This routine lets you select a list of files to be downloaded'CR
  103. SAY 'from one or more extra devices.  For example, CD-ROM drives.'CR
  104. SAY CR
  105. SAY 'Note that it is more efficient for all concerned if you use the'CR
  106. SAY 'various contents files available here (or Aquarium, in the case'CR
  107. SAY 'of Fish Disks), to make your selections before you call. Thanks!'CR
  108. SAY CR
  109.  
  110. selected=''
  111. path=''
  112. templist=devlist
  113. devlist=''
  114. longest=0
  115. CALL PRAGMA('W','N')  /* disk requesters OFF */
  116. DO i=1 TO WORDS(templist)
  117.   test=WORD(templist,i)
  118.   IF ~EXISTS(test) THEN ITERATE i
  119.   CALL PRAGMA('D',test)
  120.   test2=PRAGMA('D')
  121.   IF WORDS(test2)>1 THEN test2=test
  122.   devlist=STRIP(devlist test2)
  123.   IF LENGTH(test2)>longest THEN longest=LENGTH(test2)
  124. END
  125. cols=76%(longest+8)
  126. IF devlist='' THEN
  127.   DO
  128.     SAY CR
  129.     SAY '*** Sorry, no External Devices are available! ***'CR
  130.     SAY CR
  131.     EXIT('')
  132.   END
  133.  
  134. picklist=devlist
  135. IF WORDS(picklist)=1 THEN
  136.   DO
  137.     path=picklist
  138.     IF RIGHT(path,1)~=':' THEN path=path'/'
  139.     picklist=makepicklist()
  140.   END
  141. ELSE
  142.   DO
  143.     lists.0=1
  144.     dirs=WORDS(devlist)
  145.   END
  146. CALL checkdcd()
  147.  
  148. OPTIONS PROMPT 'Press RETURN'
  149. PULL junk
  150.  
  151. DO loop=1
  152.   CALL checkdcd()
  153.   test=TIME('E')
  154.   IF test>(maxtime-100) THEN
  155.     DO
  156.       SAY CR
  157.       IF test>maxtime THEN
  158.         DO
  159.           SAY '*** This session''s time is expiring! ***'CR
  160.           SAY CR
  161.           LEAVE loop
  162.         END
  163.       ELSE SAY '*** Less than 2 minutes remaining! ***'CR
  164.       SAY CR
  165.     END
  166.   filename=pick(picklist)
  167.   IF filename='' THEN
  168.     DO
  169.       temp=path
  170.       IF RIGHT(temp,1)='/' THEN temp=LEFT(temp,LENGTH(temp)-1)
  171.       IF FIND(UPPER(devlist),UPPER(temp))>0 THEN
  172.         DO
  173.           IF WORDS(devlist)=1 THEN ITERATE loop
  174.           picklist=devlist
  175.           path=''
  176.           ITERATE loop
  177.         END
  178.       ELSE
  179.         DO
  180.           test=RIGHT(path,1)
  181.           IF test='/' THEN path=LEFT(path,LENGTH(path)-1)
  182.           slash=LASTPOS('/',path)
  183.           IF slash=0 THEN slash=LASTPOS(':',path)
  184.           path=LEFT(path,slash)
  185.         END
  186.     END
  187.   IF filename=':-)' THEN ITERATE loop
  188.   tempath=path||filename
  189.   temp=WORD(STATEF(tempath),1)
  190.   IF temp='FILE' THEN
  191.     DO
  192.       IF FIND(UPPER(selected),UPPER(tempath))=0 THEN
  193.         selected=selected tempath
  194.       ELSE selected=DELWORD(selected,FIND(UPPER(selected),UPPER(tempath)),1)
  195.       ITERATE loop
  196.     END
  197.   ELSE IF temp='DIR' THEN
  198.     DO
  199.       path=tempath
  200.       test=RIGHT(path,1)
  201.       IF test~='' & test~='/' & test~=':' THEN path=path'/'
  202.     END
  203.   ELSE IF UPPER(filename)='DONE' THEN LEAVE loop
  204.   IF path~='' THEN picklist=makepicklist()
  205. END
  206. selected=STRIP(selected)
  207. IF selected~='' THEN
  208.   DO
  209.     SAY CR
  210.     SAY 'You may choose to have your selection(s) archived using LhA.'CR
  211.     SAY 'This makes downloading faster, if the files are not already compressed.'CR
  212.     SAY 'The completed archive will be attached to email addressed to you.'CR
  213.     SAY CR
  214.     OPTIONS PROMPT 'Archive selected files? (nY) > '
  215.     PULL temp
  216.     IF LEFT(temp,1)~='N' THEN
  217.       DO
  218.         ADDRESS AREXX bbsArcExt.rexx name selected
  219.         selected=''
  220.         SAY CR
  221.         SAY 'BBBBS will notify you online when your archive is ready.'CR
  222.         SAY CR
  223.       END
  224.   END
  225. SAY 'Returning to the BBS...'CR
  226. SAY CR
  227. EXIT selected
  228.  
  229.  
  230. checkdcd:
  231. IF ADDRESS()='BAUD' THEN
  232.   DO
  233.     dcd
  234.     IF RC=0 THEN
  235.       DO
  236.         CALL DELAY(128)
  237.         dcd
  238.         IF RC=0 THEN
  239.           DO
  240.             SAY CR
  241.             SAY '*** Lost Carrier!?! ***'CR
  242.             EXIT('')
  243.           END
  244.       END
  245.   END
  246. RETURN
  247.  
  248.  
  249. makepicklist:
  250. IF STORAGE()<100000 THEN
  251.   DO
  252.     lists.=''
  253.     lists.0=0
  254.     IF WORDS(devlist)>1 THEN
  255.       DO
  256.         lists.0=1
  257.         lists.1.0=devlist
  258.       END
  259.   END
  260. DO i=1 TO lists.0
  261.   IF path=lists.i THEN RETURN(lists.i.0)
  262. END
  263. IF path='' THEN RETURN('')
  264. SAY 'Loading...'CR
  265. CALL FileList(path'*',filelist,'F','N')
  266. IF filelist.0>1 THEN CALL QSORT(1,filelist.0,filelist)
  267. CALL FileList(path'*',dirlist,'D','N')
  268. IF dirlist.0>1 THEN CALL QSORT(1,dirlist.0,dirlist)
  269. plist=''
  270. dirs=0
  271. longest=0
  272. DO i=1 TO filelist.0
  273.   IF WORDS(filelist.i)~=1 THEN ITERATE i
  274.   IF filelist.i='' THEN ITERATE i
  275.   IF UPPER(RIGHT(filelist.i,5))='.INFO' THEN ITERATE i
  276.   IF FIND(exclude,UPPER(path||filelist.i))>0 THEN ITERATE i
  277.   plist=STRIP(plist filelist.i)
  278.   IF LENGTH(filelist.i)>longest THEN longest=LENGTH(filelist.i)
  279. END
  280. DO i=1 TO dirlist.0
  281.   IF WORDS(dirlist.i)~=1 THEN ITERATE i
  282.   IF UPPER(RIGHT(dirlist.i,5))='.INFO' THEN ITERATE i
  283.   IF FIND(exclude,UPPER(path||dirlist.i))>0 THEN ITERATE i
  284.   plist=STRIP(plist dirlist.i)
  285.   IF LENGTH(dirlist.i)>longest THEN longest=LENGTH(dirlist.i)
  286.   dirs=dirs+1
  287. END
  288. cols=76%(longest+9)
  289. lists.0=lists.0+1
  290. i=lists.0
  291. lists.i=path
  292. lists.i.0=plist
  293. DROP filelist. dirlist. 
  294. RETURN(plist)
  295.  
  296.  
  297. pick:
  298. PARSE ARG list 
  299. selection=''
  300. DO k=1 TO lists.0
  301.   IF path=lists.k THEN LEAVE k
  302. END
  303. IF ~DATATYPE(lists.k.ROWS,'N') THEN
  304.   DO
  305.     items=WORDS(list)
  306.     IF items<75 & dirs<15 THEN SAY 'Formatting' items 'items...'CR
  307.     ELSE SAY 'Please be patient, formatting' items 'items may take a while...'CR
  308.     lists.k.ROWS=(items%cols)+((items//cols)>0)
  309.     IF cols>items THEN cols=items
  310.     IF cols<1 THEN cols=1
  311.     longest=(76%cols)-8
  312.     lists.k=path
  313.     DO j=0 TO cols-1
  314.       DO i=1 TO lists.k.ROWS
  315.         thisnum=j*lists.k.ROWS+i
  316.         IF thisnum<=items THEN
  317.           DO
  318.             thisitem=WORD(list,thisnum)
  319.             filestat=STATEF(path||thisitem)
  320.             thisitem=LEFT(thisitem,longest)' '
  321.             IF WORD(filestat,1)='DIR' THEN
  322.               lists.k.i=lists.k.i||pen3'(dir) 'thisitem||def
  323.             ELSE
  324.               DO
  325.                 bytes=WORD(filestat,2)
  326.                 IF bytes<10000 THEN 
  327.                   lists.k.i=lists.k.i||RIGHT(bytes,5) thisitem
  328.                 ELSE IF bytes>1023999 THEN 
  329.                   lists.k.i=lists.k.i||RIGHT(bytes%1024000,4)'m' thisitem
  330.                 ELSE lists.k.i=lists.k.i||RIGHT(bytes%1024,4)'k' thisitem
  331.               END
  332.           END
  333.       END
  334.     END
  335.   END
  336. IF selected~='' THEN
  337.   DO
  338.     SAY CR
  339.     SAY pen3'selected:'def||CR
  340.     DO i=1 TO WORDS(selected)
  341.       SAY WORD(selected,i)||CR
  342.     END
  343.   END
  344. SAY CR
  345. SAY 'current path ='pen3 path||def||CR
  346. SAY LEFT('-',75,'-')||CR
  347. OPTIONS PROMPT ' - ['pen3'N'def']on-stop  ['pen3'Q'def']uit  ['pen3'RETURN'def']=Continue - '
  348. DO i=1 TO lists.k.ROWS
  349.   SAY TRIM(lists.k.i)||CR
  350.   IF (i+2)//(linesperpage-1)=0 & nonstop~=1 THEN
  351.     DO
  352.       CALL whodat()
  353.       PULL junk
  354.       IF LEFT(UPPER(junk),1)='Q' THEN LEAVE i
  355.       IF LEFT(UPPER(junk),1)='N' THEN nonstop=1
  356.       IF colorflag=1 THEN SAY '1B'x'M'||LEFT('',60)||'1B'x'M'||CR
  357.     END
  358. END
  359. nonstop=0
  360. SAY LEFT('-',75,'-')||CR
  361. CALL whodat()
  362. readflag=0
  363. DO getloop=1
  364.   pstring=showtime()'   Enter ''?'' for HELP > '
  365.   OPTIONS PROMPT pstring
  366.   PARSE PULL selection 
  367.   IF selection='?' THEN
  368.     DO
  369.       CALL help()
  370.       OPTIONS PROMPT 'Press RETURN'
  371.       PULL junk
  372.       selection=';-)'
  373.       LEAVE getloop
  374.     END
  375.   IF WORDS(selection)>1 THEN
  376.     DO
  377.       IF UPPER(selection)='SELECT ALL' THEN
  378.         DO
  379.           CALL selall(path)
  380.           selection=':-)'
  381.           LEAVE getloop
  382.         END
  383.       ELSE IF UPPER(WORD(selection,1))='READ' THEN
  384.         DO
  385.           readflag=1
  386.           selection=STRIP(DELWORD(selection,1,1))
  387.         END
  388.     END
  389.   i=FIND('DONE' UPPER(list),UPPER(selection))
  390.   IF i=0 THEN ITERATE getloop
  391.   IF selection='' & path='' THEN ITERATE getloop
  392.   ELSE IF i>1 THEN selection=WORD(list,i-1)
  393.   IF readflag=1 THEN
  394.     DO
  395.       endtest=UPPER(RIGHT(selection,4))
  396.       IF FIND('.ARC .DMS .LZH .LHA .ZIP .ZOO',endtest)>0 THEN
  397.         DO
  398.           CALL Contents.rexx(path||selection)
  399.           IF EXISTS('RAM:CONTENTS') THEN CALL showtext('RAM: CONTENTS')
  400.         END
  401.       ELSE CALL showtext(path selection)
  402.       readflag=0
  403.       selection=';-)'
  404.     END
  405.   LEAVE getloop
  406. END
  407. RETURN selection
  408.  
  409.  
  410. selall:
  411. PARSE ARG dir .
  412. SAY dir||CR
  413. x=RIGHT(dir,1)
  414. IF x~='/' & x~=':' THEN dir=dir'/'
  415. CALL FileList(dir'*',filelist,'F','F')
  416. DO i=1 TO filelist.0
  417.   selected=STRIP(selected filelist.i)
  418. END
  419. IF FileList(dir'*',dirlist,'D','F')=0 THEN RETURN
  420. DO j=1 TO dirlist.0
  421.   CALL selall(dirlist.j)
  422. END
  423. RETURN
  424.  
  425.  
  426. showtext:
  427. PARSE ARG tpath' 'textfile 
  428. test=RIGHT(tpath,1)
  429. IF test~='' & test~=':' & test~='/' THEN tpath=tpath'/'
  430. x=OPEN(f,STRIP(tpath||textfile),'R')
  431. IF x=0 THEN RETURN
  432. test=READCH(f,64)
  433. mask=XRANGE(,'06'x)||XRANGE('0E'x,'1A'x)||XRANGE('1C'x,'1F'x)
  434. IF VERIFY(test,mask,'M')>0 THEN
  435.   DO
  436.     CALL CLOSE(f)
  437.     testloc=VERIFY(test,mask,'M')
  438.     SAY '*** not an archive or a text file! ***'CR
  439.     SAY 'Character number' testloc 'is ASCII' C2D(SUBSTR(test,testloc,1))||CR
  440.     RETURN
  441.   END
  442. CALL SEEK(f,0,'B')
  443. OPTIONS PROMPT ' - ['pen3'N'def']on-stop  ['pen3'Q'def']uit  ['pen3'RETURN'def']=Continue - '
  444. SAY CR
  445. SAY '-' tpath||textfile '-'CR
  446. DO i=1 WHILE ~EOF(f)
  447.   SAY COMPRESS(READLN(f),CR||'0C'x)||CR
  448.   IF i//(linesperpage-1)=0 & nonstop~=1 THEN
  449.     DO
  450.       CALL whodat()
  451.       PULL junk
  452.       IF LEFT(UPPER(junk),1)='Q' THEN LEAVE i
  453.       IF LEFT(UPPER(junk),1)='N' THEN nonstop=1
  454.       IF colorflag=1 THEN SAY '1B'x'M'||LEFT('',60)||'1B'x'M'||CR
  455.     END
  456. END
  457. CALL CLOSE(f)
  458. IF i//(linesperpage-1)>1 THEN PULL junk
  459. nonstop=0
  460. RETURN
  461.  
  462.  
  463. whodat:
  464. IF ADDRESS()~='BAUD' THEN RETURN
  465. MSG RIGHT(' ',66-LENGTH(name)) '1B'x'M'||''||''||' 'name' level 'level' '||''
  466. CALL checkdcd()
  467. RETURN
  468.  
  469.  
  470. help:
  471. SAY CR
  472. SAY CR
  473. SAY pen3'- HELP -'def
  474. SAY CR
  475. SAY 'You can navigate through directory levels using the following commands.'CR
  476. SAY 'Remember that the name must appear in the display before you can select it.'CR
  477. SAY CR
  478. SAY 'To select an item from the displayed list, enter its name as displayed.'CR
  479. SAY 'If the selected item is a' pen3'directory'def', its contents will be displayed.'CR
  480. SAY 'If the selected item is a file, it is added to the ''selected'' list.'CR
  481. SAY 'To remove a selected file from the list, enter its name again.'CR
  482. SAY CR
  483. SAY 'To display the parent directory, enter an ''empty'' RETURN'CR
  484. SAY 'To read a textfile or see the contents of an archive, enter READ filename.'CR
  485. SAY 'To select ALL items from the current display, including the contents of all'CR
  486. SAY 'displayed directories and their sub-directories, enter SELECT ALL.'CR
  487. SAY CR
  488. SAY 'Enter'pen3 'DONE' def'to return to the BBS (and download any selected files)'CR
  489. SAY CR
  490. RETURN
  491.  
  492.  
  493. showtime:
  494. mins=(maxtime-TIME('E'))%60
  495. secs=TRUNC((maxtime-TIME('E'))//60)
  496. IF secs<10 THEN secs='0'secs
  497. RETURN 'Time Remaining: 'mins':'secs
  498.  
  499.  
  500. BREAK_E:
  501. SAY CR
  502. SAY pen3'*** CONTROL-E BREAK ***'def||CR
  503. i=999999
  504. RETURN ''
  505.  
  506.  
  507. BREAK_C:
  508. SAY CR
  509. EXIT ''
  510.  
  511. /* bbsExtDL.baud */
  512.